package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TWTercher;
import com.ruoyi.system.service.ITWTercherService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 外籍专任教师数Controller
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/tercher")
public class TWTercherController extends BaseController
{
    @Autowired
    private ITWTercherService tWTercherService;

    /**
     * 查询外籍专任教师数列表
     */
    @PreAuthorize("@ss.hasPermi('system:tercher:list')")
    @GetMapping("/list")
    public TableDataInfo list(TWTercher tWTercher)
    {
        startPage();
        List<TWTercher> list = tWTercherService.selectTWTercherList(tWTercher);
        return getDataTable(list);
    }

    /**
     * 导出外籍专任教师数列表
     */
    @PreAuthorize("@ss.hasPermi('system:tercher:export')")
    @Log(title = "外籍专任教师数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TWTercher tWTercher)
    {
        List<TWTercher> list = tWTercherService.selectTWTercherList(tWTercher);
        ExcelUtil<TWTercher> util = new ExcelUtil<TWTercher>(TWTercher.class);
        util.exportExcel(response, list, "外籍专任教师数数据");
    }

    /**
     * 获取外籍专任教师数详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:tercher:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tWTercherService.selectTWTercherById(id));
    }

    /**
     * 新增外籍专任教师数
     */
    @PreAuthorize("@ss.hasPermi('system:tercher:add')")
    @Log(title = "外籍专任教师数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TWTercher tWTercher)
    {
        return toAjax(tWTercherService.insertTWTercher(tWTercher));
    }

    /**
     * 修改外籍专任教师数
     */
    @PreAuthorize("@ss.hasPermi('system:tercher:edit')")
    @Log(title = "外籍专任教师数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TWTercher tWTercher)
    {
        return toAjax(tWTercherService.updateTWTercher(tWTercher));
    }

    /**
     * 删除外籍专任教师数
     */
    @PreAuthorize("@ss.hasPermi('system:tercher:remove')")
    @Log(title = "外籍专任教师数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tWTercherService.deleteTWTercherByIds(ids));
    }
}
